<template>
    <div class="article_type">
        <div class="item">
            <h3>文章类型</h3>
            <Input v-model="name" style="width: 300px" placeholder="输入文章类型"/>
            <br><br>
            <Button v-on:click="submission">提交</Button>
        </div>
    </div>
</template>

<script>
    export default {
        name: "ArticleType",
        data() {
            return {
                name: '',
            }
        },
        methods: {
            submission() {
                if (this.name == '') {
                    this.$Notice.info({
                        title: '提示',
                        desc: '请输入文章类型'
                    });
                } else {
                    let data = {
                        name: this.name
                    }

                    this.$api.post('admin/setArticleType', {type: data}).then((res) => {
                        //写数据
                        console.log(res)
                        if (res.code === 403) {
                            this.$router.push({path: '/login'})
                        } else {
                            this.$Notice.info({
                                title: '提示',
                                desc: res.message
                            })
                        }
                    })
                }

            }
        }
    }
</script>

<style>
    .article_type {
        padding: 40px 10vw 40px 10vw;
        text-align: left;
    }
</style>
